package com.monster.datasourcejob.typeconverter.fieldtype;

/**
 * description:
 *
 * @author Yuanml on 2021/6/29 15:58
 */
public enum HiveType {
    BOOLEAN("BOOLEAN"),
    TINYINT("TINYINT"),
    SMALLINT("SMALLINT"),
    INT("INT"),
    BIGINT("BIGINT"),
    FLOAT("FLOAT"),
    DOUBLE("DOUBLE"),
    DECIMAL("DECIMAL"),
    STRING("STRING"),
    VARCHAR("VARCHAR"),
    CHAR("CHAR"),
    BINARY("BINARY"),
    TIMESTAMP("TIMESTAMP"),
    DATE("DATE"),
    ;
    private final String typeName;

    HiveType(String typeName) {
        this.typeName = typeName;
    }

    public String getTypeName() {
        return typeName;
    }

    public static HiveType getByTypeName(String typeName) {
        typeName = typeName.toUpperCase();
        return HiveType.valueOf(typeName);
    }

    public static void main(String[] args) {
        //boolean,tinyint,smallint,int,bigint,float,double,deicimal,String,varchar,char,binary,timestamp,date


        String str = "boolean,tinyint,smallint,int,bigint,float,double,deicimal,String,varchar,char,binary,timestamp,date";
        String res = "";
        for (String s : str.split(",")) {
            s = s.toUpperCase();
            res += s + "(\"" + s + "\"),\n";
        }

        System.out.println(res);

    }
}
